﻿/******************************************************************************
* File description: wordExporter.h
* Function: Word报告导出功能实现
* Current Version: 1.0.0
* Author: JNN
* Date: 2025-07-01
*  -----
*  Copyright by 博坤生物 .
 *****************************************************************************/

#ifndef WORDEXPORTER_H
#define WORDEXPORTER_H

#include <QFile>
#include <QObject>
#include <QMap>
#include <QTime>
#include <QDebug>
#include <QDir>
#include "logHelper/debugLog.h"
#include "QtGui/private/qzipreader_p.h"
#include "QtGui/private/qzipwriter_p.h"
#include "stdio.h"

class WordExporter
{
public:
    WordExporter();

    int exportWord(QString filePath, QString fileName, QMap<QString, QString> expInfo, QVector<QStringList> expLogs);       // 导出word文件 0 导出成功  -1 模板丢失 -2 打开文件失败 -3 导出失败 -4 导出文件夹路径创建失败
    int exportWord(QString filePath, QString fileName, QVariantMap expInfo, QVariantList expLogs);                          // 导出word文件 0 导出成功  -1 模板丢失 -2 打开文件失败 -3 导出失败 -4 导出文件夹路径创建失败

private:

    bool updateExportInfo(QString filePath, QString fileName, QMap<QString, QString> expInfo, QVector<QStringList> expLogs);
    bool updateExportInfo(QString filePath, QString fileName, QVariantMap expInfo, QVariantList expLogs);
    bool checkZipTemplate();
    bool createDocument();
    bool createZipper();

    QString createDocumentStr();

    QStringList                 _zipFileList;

    QString                     _docPath;

    QString                     _filePath;
    QString                     _fileName;
    QMap<QString, QString>      _expInfo;
    QVector<QStringList>        _expLogs;

    QStringList                 _paramList;

};

#endif // WORDEXPORTER_H
